#!/bin/sh 
#
# ---------------------------------------------------------------------
#                    LAN Distributed Platform - LANDP
#
#               5724-B16 (C) Copyright IBM Corp 1987, 2002
#      All Rights Reserved - Licensed Materials - Property of IBM
# ---------------------------------------------------------------------
#
# *** ID=GENRUN   VL=A6000 HD16098I  ***

  [ -f EHCL100/ehcmap.so ] && mv -f EHCL100/ehcmap.so EHCL100/libehcmap.so.6
  [ -f EHCL100/ehclnx.so ] && mv -f EHCL100/ehclnx.so EHCL100/libehclnx.so.6
  [ -f EHCL100/ehcingrt.so ] && mv -f EHCL100/ehcingrt.so EHCL100/libehcingrt.so

  PATH=./EHCL100:$PATH
  export LD_LIBRARY_PATH=./EHCL100:$LD_LIBRARY_PATH

  clear
  ehclabel
  ehcgrti0 $1 $2 $3 $4 $5 $6
  case $? in 
    10) ;;
    1)  exit;;
    *)  echo "ERROR : Internal Error ($?) checking customization status"
        exit;;
  esac

  loader spv -B1 >/dev/null
  case $? in 
    0)  ;;
    2)  echo "ERROR : LANDP SUPERVISOR ALREADY LOADED."
        exit;;
    *)  echo "ERROR : Internal Error ($?)"
        exit;;
  esac

  while true
  do
    . ./logpath
    loader shfile## -C:ehcparam -B:20 -L:1 >/dev/null
    case $? in 
      0) 
        ehcgrtim $1 $2 $3 $4 $5 $6
        break;;
      8|44|166)
        echo "ERROR : Insufficent storage to load SHFILE##"
        break;;
      48)
        echo "Internal error - Shared file server failed to load"
        break;;
      99)
        echo "GENRUN interrupted by user."
        break;;
      150|153|168)
        if [-z ehcrep]; then
          rm -f log.dat
          ehcrep="Y"
        else
          echo "Internal error ($?)."
          break
        fi;;
      152)
        if [-z ehcrep]; then
          ehcrep="Y"
        else
          echo "Internal error ($?)."
          break
        fi;;
      *)
        echo "Internal error ($?)."
        break;;
    esac
  done

  ehcfree spv >/dev/null
  exit


